home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / dlcapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  33.4 KB  |  918 lines

  1. /*++
  2.  
  3. Copyright (c) 1991-1996  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     dlcapi.h
  8.  
  9. Abstract:
  10.  
  11.     This module defines 32-bit Windows/NT DLC structures and manifests
  12.  
  13. Revision History:
  14.  
  15. --*/
  16. /*
  17.  *      C/C++ Run Time Library - Version 9.0
  18.  *
  19.  *      Copyright (c) 1994, 1998 by Borland International
  20.  *      All Rights Reserved.
  21.  *
  22.  */
  23.  
  24. #ifndef _DLCAPI_
  25. #define _DLCAPI_
  26. #pragma option push -b
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. //
  33. // DLC Command Codes
  34. //
  35.  
  36. #define LLC_DIR_INTERRUPT               0x00
  37. #define LLC_DIR_OPEN_ADAPTER            0x03
  38. #define LLC_DIR_CLOSE_ADAPTER           0x04
  39. #define LLC_DIR_SET_MULTICAST_ADDRESS   0x05
  40. #define LLC_DIR_SET_GROUP_ADDRESS       0x06
  41. #define LLC_DIR_SET_FUNCTIONAL_ADDRESS  0x07
  42. #define LLC_DIR_READ_LOG                0x08
  43. #define LLC_TRANSMIT_FRAMES             0x09
  44. #define LLC_TRANSMIT_DIR_FRAME          0x0A
  45. #define LLC_TRANSMIT_I_FRAME            0x0B
  46. #define LLC_TRANSMIT_UI_FRAME           0x0D
  47. #define LLC_TRANSMIT_XID_CMD            0x0E
  48. #define LLC_TRANSMIT_XID_RESP_FINAL     0x0F
  49. #define LLC_TRANSMIT_XID_RESP_NOT_FINAL 0x10
  50. #define LLC_TRANSMIT_TEST_CMD           0x11
  51. #define LLC_DLC_RESET                   0x14
  52. #define LLC_DLC_OPEN_SAP                0x15
  53. #define LLC_DLC_CLOSE_SAP               0x16
  54. #define LLC_DLC_REALLOCATE_STATIONS     0x17
  55. #define LLC_DLC_OPEN_STATION            0x19
  56. #define LLC_DLC_CLOSE_STATION           0x1A
  57. #define LLC_DLC_CONNECT_STATION         0x1B
  58. #define LLC_DLC_MODIFY                  0x1C
  59. #define LLC_DLC_FLOW_CONTROL            0x1D
  60. #define LLC_DLC_STATISTICS              0x1E
  61. #define LLC_DIR_INITIALIZE              0x20
  62. #define LLC_DIR_STATUS                  0x21
  63. #define LLC_DIR_TIMER_SET               0x22
  64. #define LLC_DIR_TIMER_CANCEL            0x23
  65. #define LLC_BUFFER_GET                  0x26
  66. #define LLC_BUFFER_FREE                 0x27
  67. #define LLC_RECEIVE                     0x28
  68. #define LLC_RECEIVE_CANCEL              0x29
  69. #define LLC_RECEIVE_MODIFY              0x2A
  70. #define LLC_DIR_TIMER_CANCEL_GROUP      0x2C
  71. #define LLC_DIR_SET_EXCEPTION_FLAGS     0x2D
  72. #define LLC_BUFFER_CREATE               0x30
  73. #define LLC_READ                        0x31
  74. #define LLC_READ_CANCEL                 0x32
  75. #define LLC_DLC_SET_THRESHOLD           0x33
  76. #define LLC_DIR_CLOSE_DIRECT            0x34
  77. #define LLC_DIR_OPEN_DIRECT             0x35
  78. #define LLC_MAX_DLC_COMMAND             0x37
  79.  
  80. //
  81. // forward definitions
  82. //
  83.  
  84. union _LLC_PARMS;
  85. typedef union _LLC_PARMS LLC_PARMS, *PLLC_PARMS;
  86.  
  87. //
  88. // Parameters. Can be pointer to a parameter table (32-bit flat address),
  89. // a single 32-bit ULONG, 2 16-bit USHORTs or 4 8-bit BYTEs
  90. //
  91.  
  92. typedef union {
  93.  
  94.     PLLC_PARMS pParameterTable;     // pointer to the parameter table
  95.  
  96.     struct {
  97.         USHORT usStationId;         // Station id
  98.         USHORT usParameter;         // optional parameter
  99.     } dlc;
  100.  
  101.     struct {
  102.         USHORT usParameter0;        // first optional parameter
  103.         USHORT usParameter1;        // second optional parameter
  104.     } dir;
  105.  
  106.     UCHAR auchBuffer[4];            // group/functional address
  107.  
  108.     ULONG ulParameter;
  109.  
  110. } CCB_PARMS;
  111.  
  112. //
  113. // LLC_CCB - the Command Control Block structure
  114. //
  115.  
  116. typedef struct _LLC_CCB {
  117.     UCHAR uchAdapterNumber;         // Adapter 0 or 1
  118.     UCHAR uchDlcCommand;            // DLC command
  119.     UCHAR uchDlcStatus;             // DLC command completion code
  120.     UCHAR uchReserved1;             // reserved for DLC DLL
  121.     struct _LLC_CCB* pNext;         // CCB chain
  122.     ULONG ulCompletionFlag;         // used in command completion
  123.     CCB_PARMS u;                    // parameters
  124.     HANDLE hCompletionEvent;        // event for command completion
  125.     UCHAR uchReserved2;             // reserved for DLC DLL
  126.     UCHAR uchReadFlag;              // set when special READ CCB chained
  127.     USHORT usReserved3;             // reserved for DLC DLL
  128. } LLC_CCB, *PLLC_CCB;
  129.  
  130. //
  131. // transmit/receive buffers
  132. //
  133.  
  134. union _LLC_BUFFER;
  135. typedef union _LLC_BUFFER LLC_BUFFER, *PLLC_BUFFER;
  136.  
  137. typedef struct {
  138.     PLLC_BUFFER pNextBuffer;        // next DLC buffer in frame
  139.     USHORT cbFrame;                 // length of the whole received frame
  140.     USHORT cbBuffer;                // length of this segment
  141.     USHORT offUserData;             // offset of data from descriptor header
  142.     USHORT cbUserData;              // length of the data
  143. } LLC_NEXT_BUFFER;
  144.  
  145. typedef struct {
  146.     PLLC_BUFFER pNextBuffer;        // next buffer of frame
  147.     USHORT cbFrame;                 // length of entire frame
  148.     USHORT cbBuffer;                // length of this buffer
  149.     USHORT offUserData;             // user data in this struct
  150.     USHORT cbUserData;              // length of user data
  151.     USHORT usStationId;             // ssnn station id
  152.     UCHAR uchOptions;               // option byte from RECEIVE param tbl
  153.     UCHAR uchMsgType;               // the message type
  154.     USHORT cBuffersLeft;            // number of basic buffer units left
  155.     UCHAR uchRcvFS;                 // the reveived frame status
  156.     UCHAR uchAdapterNumber;         // adapter number
  157.     PLLC_BUFFER pNextFrame;         // pointer to next frame
  158.     UCHAR cbLanHeader;              // length of the lan header
  159.     UCHAR cbDlcHeader;              // length of the DLC header
  160.     UCHAR auchLanHeader[32];        // lan header of the received frame
  161.     UCHAR auchDlcHeader[4];         // dlc header of the received frame
  162.     USHORT usPadding;               // data begins from offset 64 !!!
  163. } LLC_NOT_CONTIGUOUS_BUFFER;
  164.  
  165. typedef struct {
  166.     PLLC_BUFFER pNextBuffer;        // next buffer of frame
  167.     USHORT cbFrame;                 // length of entire frame
  168.     USHORT cbBuffer;                // length of this buffer
  169.     USHORT offUserData;             // user data in this struct
  170.     USHORT cbUserData;              // length of user data
  171.     USHORT usStationId;             // ssnn station id
  172.     UCHAR uchOptions;               // option byte from RECEIVE param tbl
  173.     UCHAR uchMsgType;               // the message type
  174.     USHORT cBuffersLeft;            // number of basic buffer units left
  175.     UCHAR uchRcvFS;                 // the reveived frame status
  176.     UCHAR uchAdapterNumber;         // adapter number
  177.     PLLC_BUFFER pNextFrame;         // pointer to next frame
  178. } LLC_CONTIGUOUS_BUFFER;
  179.  
  180. //
  181. // Received frames are returned in these data structures
  182. //
  183.  
  184. union _LLC_BUFFER {
  185.  
  186.     PLLC_BUFFER pNext;
  187.  
  188.     LLC_NEXT_BUFFER Next;
  189.  
  190.     struct LlcNextBuffer {
  191.         LLC_NEXT_BUFFER Header;
  192.         UCHAR auchData[];
  193.     } Buffer;
  194.  
  195.     LLC_NOT_CONTIGUOUS_BUFFER NotContiguous;
  196.  
  197.     struct {
  198.         LLC_NOT_CONTIGUOUS_BUFFER Header;
  199.         UCHAR auchData[];
  200.     } NotCont;
  201.  
  202.     LLC_CONTIGUOUS_BUFFER Contiguous;
  203.  
  204.     struct {
  205.         LLC_CONTIGUOUS_BUFFER Header;
  206.         UCHAR auchData[];
  207.     } Cont;
  208.  
  209. };
  210.  
  211. //
  212. // This structure is used by BUFFER.GET, BUFFER.FREE and TRANSMIT
  213. //
  214.  
  215. struct _LLC_XMIT_BUFFER;
  216. typedef struct _LLC_XMIT_BUFFER LLC_XMIT_BUFFER, *PLLC_XMIT_BUFFER;
  217.  
  218. struct _LLC_XMIT_BUFFER {
  219.     PLLC_XMIT_BUFFER pNext;         // next buffer (or NULL)
  220.     USHORT usReserved1;             //
  221.     USHORT cbBuffer;                // length of transmitted data
  222.     USHORT usReserved2;             //
  223.     USHORT cbUserData;              // length of optional header
  224.     UCHAR auchData[];               // optional header and transmitted data
  225. };
  226.  
  227. #define LLC_XMIT_BUFFER_SIZE sizeof(LLC_XMIT_BUFFER)
  228.  
  229. //
  230. // CCB parameter tables
  231. //
  232.  
  233. typedef struct {
  234.     HANDLE hBufferPool;             // handle of new buffer pool
  235.     PVOID pBuffer;                  // any buffer in memory
  236.     ULONG cbBufferSize;             // buffer size in bytes
  237.     ULONG cbMinimumSizeThreshold;   // minimum locked size
  238. } LLC_BUFFER_CREATE_PARMS, *PLLC_BUFFER_CREATE_PARMS;
  239.  
  240. typedef struct {
  241.     USHORT usReserved1;             // Station id is not used
  242.     USHORT cBuffersLeft;            // free 256 buffer segments
  243.     ULONG ulReserved;
  244.     PLLC_XMIT_BUFFER pFirstBuffer;  // buffer chain
  245. } LLC_BUFFER_FREE_PARMS, *PLLC_BUFFER_FREE_PARMS;
  246.  
  247. typedef struct {
  248.     USHORT usReserved1;             // Station id is not used
  249.     USHORT cBuffersLeft;            // free 256 buffer segments
  250.  
  251.     //
  252.     // cBuffersToGet: number of buffers to get. If 0, the returned buffer list
  253.     // may consist of segment of different size
  254.     //
  255.  
  256.     USHORT cBuffersToGet;
  257.  
  258.     //
  259.     // cbBufferSize: size of the requested buffers. This will be rounded up to
  260.     // the next largest segment size: 256, 512, 1024, 2048 or 4096
  261.     //
  262.  
  263.     USHORT cbBufferSize;
  264.     PLLC_XMIT_BUFFER pFirstBuffer;
  265. } LLC_BUFFER_GET_PARMS, *PLLC_BUFFER_GET_PARMS;
  266.  
  267. //
  268. // parameter table for DLC.CONNECT.STATION
  269. //
  270.  
  271. typedef struct {
  272.     USHORT usStationId;             // SAP or direct station ID, defines the pool
  273.     USHORT usReserved;
  274.     PUCHAR pRoutingInfo;            // offset to the routing info
  275. } LLC_DLC_CONNECT_PARMS, *PLLC_DLC_CONNECT_PARMS;
  276.  
  277. //
  278. // DLC_FLOW_CONTROL Options:
  279. //
  280.  
  281. #define LLC_RESET_LOCAL_BUSY_USER   0x80
  282. #define LLC_RESET_LOCAL_BUSY_BUFFER 0xC0
  283. #define LLC_SET_LOCAL_BUSY_USER     0
  284.  
  285. typedef struct {
  286.     USHORT usRes;
  287.     USHORT usStationId;             // SAP or link station id
  288.     UCHAR uchT1;                    // response timer
  289.     UCHAR uchT2;                    // aknowledgment timer
  290.     UCHAR uchTi;                    // inactivity timer
  291.     UCHAR uchMaxOut;                // max transmits without ack
  292.     UCHAR uchMaxIn;                 // max receives without ack
  293.     UCHAR uchMaxOutIncr;            // dynamic window increment value
  294.     UCHAR uchMaxRetryCnt;           // N2 value (retries)
  295.     UCHAR uchReserved1;
  296.     USHORT usMaxInfoFieldLength;    // Only for link stations, NEW!!!
  297.     UCHAR uchAccessPriority;        // token ring access priority
  298.     UCHAR auchReserved3[4];
  299.     UCHAR cGroupCount;              // number of group SAPs of this SAP
  300.     PUCHAR pGroupList;              // offset to the group list
  301. } LLC_DLC_MODIFY_PARMS, *PLLC_DLC_MODIFY_PARMS;
  302.  
  303. #define LLC_XID_HANDLING_IN_APPLICATION 0x08
  304. #define LLC_XID_HANDLING_IN_DLC         0
  305. #define LLC_INDIVIDUAL_SAP              0x04
  306. #define LLC_GROUP_SAP                   0x02
  307. #define LLC_MEMBER_OF_GROUP_SAP         0x01
  308.  
  309. typedef struct {
  310.     USHORT usStationId;             // SAP or link station id
  311.     USHORT usUserStatValue;         // reserved for user
  312.     UCHAR uchT1;                    // response timer
  313.     UCHAR uchT2;                    // aknowledgment timer
  314.     UCHAR uchTi;                    // inactivity timer
  315.     UCHAR uchMaxOut;                // max tramists without ack
  316.     UCHAR uchMaxIn;                 // max receives without ack
  317.     UCHAR uchMaxOutIncr;            // dynamic window increment value
  318.     UCHAR uchMaxRetryCnt;           // N2 value (retries)
  319.     UCHAR uchMaxMembers;            // maximum members for group SAP
  320.     USHORT usMaxI_Field;            // maximum length of the Info field
  321.     UCHAR uchSapValue;              // SAP value to be assigned
  322.     UCHAR uchOptionsPriority;       // SAP options and access priority
  323.     UCHAR uchcStationCount;         // maximum number of link stations in sap
  324.     UCHAR uchReserved2[2];          //
  325.     UCHAR cGroupCount;              // number of group SAPs of this SAP
  326.     PUCHAR pGroupList;              // offset to the group list
  327.     ULONG DlcStatusFlags;           // User notify flag for DLC status changes
  328.     UCHAR uchReserved3[8];          // reserved
  329.     UCHAR cLinkStationsAvail;       // total number of available link stations
  330. } LLC_DLC_OPEN_SAP_PARMS, *PLLC_DLC_OPEN_SAP_PARMS;
  331.  
  332. typedef struct {
  333.     USHORT usSapStationId;          // SAP station id
  334.     USHORT usLinkStationId;         // Link station id
  335.     UCHAR uchT1;                    // response timer
  336.     UCHAR uchT2;                    // aknowledgment timer
  337.     UCHAR uchTi;                    // inactivity timer
  338.     UCHAR uchMaxOut;                // max tramists without ack
  339.     UCHAR uchMaxIn;                 // max receives without ack
  340.     UCHAR uchMaxOutIncr;            // dynamic window increment value
  341.     UCHAR uchMaxRetryCnt;           // N2 value (retries)
  342.     UCHAR uchRemoteSap;             // remote SAP of the link
  343.     USHORT usMaxI_Field;            // max I field length
  344.     UCHAR uchAccessPriority;        // token ring access priority
  345.     PVOID pRemoteNodeAddress;       // pointer to the destination address
  346. } LLC_DLC_OPEN_STATION_PARMS, *PLLC_DLC_OPEN_STATION_PARMS;
  347.  
  348. #define LLC_INCREASE_LINK_STATIONS  0
  349. #define LLC_DECREASE_LINK_STATIONS  0x80
  350.  
  351. typedef struct {
  352.     USHORT usStationId;             // ID of affected SAP
  353.     UCHAR uchOption;                // increase of decrease indicator
  354.     UCHAR uchStationCount;
  355.     UCHAR uchStationsAvailOnAdapter;
  356.     UCHAR uchStationsAvailOnSap;
  357.     UCHAR uchTotalStationsOnAdapter;
  358.     UCHAR uchTotalStationsOnSap;
  359. } LLC_DLC_REALLOCATE_PARMS, *PLLC_DLC_REALLOCATE_PARMS;
  360.  
  361. typedef struct {
  362.     USHORT usStationId;             // SAP station ID
  363.     USHORT cBufferThreshold;        // SAP buffer pool Threshold number
  364.     PVOID AlertEvent;               // alerting event
  365. } LLC_DLC_SET_THRESHOLD_PARMS, *PLLC_DLC_SET_THRESHOLD_PARMS;
  366.  
  367. typedef struct {
  368.     PVOID TraceBuffer;              // trace buffer
  369.     ULONG TraceBufferSize;          // trace buffer size
  370.     ULONG TraceFlags;               // various trace flags
  371. } LLC_TRACE_INITIALIZE_PARMS, *PLLC_TRACE_INITIALIZE_PARMS;
  372.  
  373. #define LLC_DLC_RESET_STATISTICS    0x80
  374. #define LLC_DLC_READ_STATISTICS     0
  375.  
  376. typedef struct {
  377.     ULONG cTransmittedFrames;
  378.     ULONG cReceivedFrames;
  379.     ULONG cDiscardedFrames;
  380.     ULONG cDataLost;
  381.     USHORT cBuffersAvailable;
  382. } DLC_SAP_LOG, *PDLC_SAP_LOG;
  383.  
  384. typedef struct {
  385.     USHORT cI_FramesTransmitted;
  386.     USHORT cI_FramesReceived;
  387.     UCHAR cI_FrameReceiveErrors;
  388.     UCHAR cI_FrameTransmissionErrors;
  389.     USHORT cT1_ExpirationCount;     // Note: not OUT data xfer mode
  390.     UCHAR uchLastCmdRespReceived;
  391.     UCHAR uchLastCmdRespTransmitted;
  392.     UCHAR uchPrimaryState;
  393.     UCHAR uchSecondaryState;
  394.     UCHAR uchSendStateVariable;
  395.     UCHAR uchReceiveStateVariable;
  396.     UCHAR uchLastNr;                // last received NR
  397.     UCHAR cbLanHeader;
  398.     UCHAR auchLanHeader[32];
  399. } DLC_LINK_LOG, *PDLC_LINK_LOG;
  400.  
  401. typedef union {
  402.     DLC_SAP_LOG Sap;
  403.     DLC_LINK_LOG Link;
  404. } LLC_DLC_LOG_BUFFER, *PLLC_DLC_LOG_BUFFER;
  405.  
  406. typedef struct {
  407.     USHORT usStationId;             // ID of a SAP or a link station
  408.     USHORT cbLogBufSize;            //
  409.     PLLC_DLC_LOG_BUFFER pLogBuf;    // offset to the log buffer
  410.     USHORT usActLogLength;          // length of returned log
  411.     UCHAR uchOptions;               // command options (bit7 resets log params)
  412. } LLC_DLC_STATISTICS_PARMS, *PLLC_DLC_STATISTICS_PARMS;
  413.  
  414. typedef struct {
  415.     USHORT usBringUps;              // Token Ring adapter bring up error code
  416.     UCHAR Reserved[30];             // everything else specific to DOS or OS/2
  417. } LLC_DIR_INITIALIZE_PARMS, *PLLC_DIR_INITIALIZE_PARMS;
  418.  
  419. typedef struct {
  420.     USHORT usOpenErrorCode;         // open adapter errors detected
  421.     USHORT usOpenOptions;           // various options
  422.     UCHAR auchNodeAddress[6];       // adapters LAN address
  423.     UCHAR auchGroupAddress[4];      // multicast address added in the open
  424.     UCHAR auchFunctionalAddress[4]; // added token ring functional address
  425.     USHORT usReserved1;
  426.     USHORT usReserved2;
  427.     USHORT usMaxFrameSize;          // maximum frame size defined in NDIS
  428.     USHORT usReserved3[4];
  429.     USHORT usBringUps;              // Bring up errors, TR only
  430.     USHORT InitWarnings;
  431.     USHORT usReserved4[3];
  432. } LLC_ADAPTER_OPEN_PARMS, *PLLC_ADAPTER_OPEN_PARMS;
  433.  
  434. typedef struct {
  435.     UCHAR uchDlcMaxSaps;
  436.     UCHAR uchDlcMaxStations;
  437.     UCHAR uchDlcMaxGroupSaps;
  438.     UCHAR uchDlcMaxGroupMembers;
  439.     UCHAR uchT1_TickOne;            // Short timer interval (for 1 - 5)
  440.     UCHAR uchT2_TickOne;
  441.     UCHAR uchTi_TickOne;
  442.     UCHAR uchT1_TickTwo;            // Long timer interval (for 6 - 10)
  443.     UCHAR uchT2_TickTwo;
  444.     UCHAR uchTi_TickTwo;
  445. } LLC_DLC_PARMS, *PLLC_DLC_PARMS;
  446.  
  447. //
  448. // The ethernet mode selects the LAN header format of ethernet. SNA
  449. // applications should use the default parameter, that has been defined in the
  450. // registry. The applications using connectionless DLC services should select
  451. // the ethernet LLC LAN header format they are using (usually 802.3)
  452. //
  453.  
  454. typedef enum {
  455.     LLC_ETHERNET_TYPE_DEFAULT,      // use the parameter value set in registry
  456.     LLC_ETHERNET_TYPE_AUTO,         // automatic header type selction for links
  457.     LLC_ETHERNET_TYPE_802_3,        // use always 802.3 lan headers
  458.     LLC_ETHERNET_TYPE_DIX           // use always LLC on DIX SNA type.
  459. } LLC_ETHERNET_TYPE, *PLLC_ETHERNET_TYPE;
  460.  
  461. typedef struct {
  462.     PVOID hBufferPool;
  463.     PVOID pSecurityDescriptor;
  464.     LLC_ETHERNET_TYPE LlcEthernetType;
  465. } LLC_EXTENDED_ADAPTER_PARMS, *PLLC_EXTENDED_ADAPTER_PARMS;
  466.  
  467. typedef struct {
  468.     PLLC_ADAPTER_OPEN_PARMS pAdapterParms;      // ADAPTER_PARMS
  469.     PLLC_EXTENDED_ADAPTER_PARMS pExtendedParms; // DIRECT_PARMS
  470.     PLLC_DLC_PARMS pDlcParms;                   // DLC_PARMS
  471.     PVOID pReserved1;                           // NCB_PARMS
  472. } LLC_DIR_OPEN_ADAPTER_PARMS, *PLLC_DIR_OPEN_ADAPTER_PARMS;
  473.  
  474. typedef struct {
  475.     UCHAR auchMulticastAddress[6];  // 48 bit multicast address
  476. } LLC_DIR_MULTICAST_ADDRESS, *PLLC_DIR_MULTICAST_ADDRESS;
  477.  
  478. #define LLC_DIRECT_OPTIONS_ALL_MACS 0x1880
  479.  
  480. typedef struct {
  481.     USHORT Reserved[4];
  482.     USHORT usOpenOptions;
  483.     USHORT usEthernetType;
  484.     ULONG ulProtocolTypeMask;
  485.     ULONG ulProtocolTypeMatch;
  486.     USHORT usProtocolTypeOffset;
  487. } LLC_DIR_OPEN_DIRECT_PARMS, *PLLC_DIR_OPEN_DIRECT_PARMS;
  488.  
  489. typedef struct {
  490.     UCHAR cLineError;
  491.     UCHAR cInternalError;
  492.     UCHAR cBurstError;
  493.     UCHAR cAC_Error;
  494.     UCHAR cAbortDelimiter;
  495.     UCHAR uchReserved1;
  496.     UCHAR cLostFrame;
  497.     UCHAR cReceiveCongestion;
  498.     UCHAR cFrameCopiedError;
  499.     UCHAR cFrequencyError;
  500.     UCHAR cTokenError;
  501.     UCHAR uchReserved2;
  502.     UCHAR uchReserved3;
  503.     UCHAR uchReserved4;
  504. } LLC_ADAPTER_LOG_TR, *PLLC_ADAPTER_LOG_TR;
  505.  
  506. typedef struct {
  507.     UCHAR cCRC_Error;
  508.     UCHAR uchReserved1;
  509.     UCHAR cAlignmentError;
  510.     UCHAR uchReserved2;
  511.     UCHAR cTransmitError;
  512.     UCHAR uchReserved3;
  513.     UCHAR cCollisionError;
  514.     UCHAR cReceiveCongestion;
  515.     UCHAR uchReserved[6];
  516. } LLC_ADAPTER_LOG_ETH, *PLLC_ADAPTER_LOG_ETH;
  517.  
  518. typedef union {
  519.     LLC_ADAPTER_LOG_TR Tr;
  520.     LLC_ADAPTER_LOG_ETH Eth;
  521. } LLC_ADAPTER_LOG, *PLLC_ADAPTER_LOG;
  522.  
  523. typedef struct {
  524.     ULONG cTransmittedFrames;
  525.     ULONG cReceivedFrames;
  526.     ULONG cDiscardedFrames;
  527.     ULONG cDataLost;
  528.     USHORT cBuffersAvailable;
  529. } LLC_DIRECT_LOG, *PLLC_DIRECT_LOG;
  530.  
  531. typedef union {
  532.     LLC_ADAPTER_LOG Adapter;
  533.     LLC_DIRECT_LOG Dir;
  534.  
  535.     struct {
  536.         LLC_ADAPTER_LOG Adapter;
  537.         LLC_DIRECT_LOG Dir;
  538.     } both;
  539.  
  540. } LLC_DIR_READ_LOG_BUFFER, *PLLC_DIR_READ_LOG_BUFFER;
  541.  
  542. #define LLC_DIR_READ_LOG_ADAPTER    0
  543. #define LLC_DIR_READ_LOG_DIRECT     1
  544. #define LLC_DIR_READ_LOG_BOTH       2
  545.  
  546. typedef struct {
  547.     USHORT usTypeId;                    // 0=adapter, 1=direct, 2=both logs
  548.     USHORT cbLogBuffer;                 // size of log buffer
  549.     PLLC_DIR_READ_LOG_BUFFER pLogBuffer;// pointer to log buffer
  550.     USHORT cbActualLength;              // returned size of log buffer
  551. } LLC_DIR_READ_LOG_PARMS, *PLLC_DIR_READ_LOG_PARMS;
  552.  
  553. typedef struct {
  554.     ULONG ulAdapterCheckFlag;
  555.     ULONG ulNetworkStatusFlag;
  556.     ULONG ulPcErrorFlag;
  557.     ULONG ulSystemActionFlag;
  558. } LLC_DIR_SET_EFLAG_PARMS, *PLLC_DIR_SET_EFLAG_PARMS;
  559.  
  560. #define LLC_ADAPTER_ETHERNET    0x0010
  561. #define LLC_ADAPTER_TOKEN_RING  0x0040
  562.  
  563. typedef struct {
  564.     UCHAR auchPermanentAddress[6];  // permanent encoded address
  565.     UCHAR auchNodeAddress[6];       // adapter's network address
  566.     UCHAR auchGroupAddress[4];      // adapter's group address
  567.     UCHAR auchFunctAddr[4];         // adapter's functional address
  568.     UCHAR uchMaxSap;                // maximum allowable SAP
  569.     UCHAR uchOpenSaps;              // number of currently open saps
  570.     UCHAR uchMaxStations;           // max number of stations (always 253)
  571.     UCHAR uchOpenStation;           // number of open stations (only up to 253)
  572.     UCHAR uchAvailStations;         // number of available stations (always 253)
  573.     UCHAR uchAdapterConfig;         // adapter configuration flags
  574.     UCHAR auchReserved1[10];        // microcode level
  575.     ULONG ulReserved1;
  576.     ULONG ulReserved2;
  577.     ULONG ulMaxFrameLength;         // maximum frame length (only in Windows/Nt)
  578.     USHORT usLastNetworkStatus;
  579.     USHORT usAdapterType;           // THIS BYTE IS NOT USED IN DOS DLC !!!
  580. } LLC_DIR_STATUS_PARMS, *PLLC_DIR_STATUS_PARMS;
  581.  
  582.  
  583. #define LLC_OPTION_READ_STATION 0
  584. #define LLC_OPTION_READ_SAP     1
  585. #define LLC_OPTION_READ_ALL     2
  586.  
  587. #define LLC_EVENT_SYSTEM_ACTION         0x0040
  588. #define LLC_EVENT_NETWORK_STATUS        0x0020
  589. #define LLC_EVENT_CRITICAL_EXCEPTION    0x0010
  590. #define LLC_EVENT_STATUS_CHANGE         0x0008
  591. #define LLC_EVENT_RECEIVE_DATA          0x0004
  592. #define LLC_EVENT_TRANSMIT_COMPLETION   0x0002
  593. #define LLC_EVENT_COMMAND_COMPLETION    0x0001
  594. #define LLC_READ_ALL_EVENTS             0x007F
  595.  
  596. //
  597. // LLC_STATUS_CHANGE indications
  598. // The returned status value may be an inclusive-OR of several flags
  599. //
  600.  
  601. #define LLC_INDICATE_LINK_LOST              0x8000
  602. #define LLC_INDICATE_DM_DISC_RECEIVED       0x4000
  603. #define LLC_INDICATE_FRMR_RECEIVED          0x2000
  604. #define LLC_INDICATE_FRMR_SENT              0x1000
  605. #define LLC_INDICATE_RESET                  0x0800
  606. #define LLC_INDICATE_CONNECT_REQUEST        0x0400
  607. #define LLC_INDICATE_REMOTE_BUSY            0x0200
  608. #define LLC_INDICATE_REMOTE_READY           0x0100
  609. #define LLC_INDICATE_TI_TIMER_EXPIRED       0x0080
  610. #define LLC_INDICATE_DLC_COUNTER_OVERFLOW   0x0040
  611. #define LLC_INDICATE_ACCESS_PRTY_LOWERED    0x0020
  612. #define LLC_INDICATE_LOCAL_STATION_BUSY     0x0001
  613.  
  614. typedef struct {
  615.     USHORT usStationId;
  616.     UCHAR uchOptionIndicator;
  617.     UCHAR uchEventSet;
  618.     UCHAR uchEvent;
  619.     UCHAR uchCriticalSubset;
  620.     ULONG ulNotificationFlag;
  621.  
  622.     union {
  623.  
  624.         struct {
  625.             USHORT usCcbCount;
  626.             PLLC_CCB pCcbCompletionList;
  627.             USHORT usBufferCount;
  628.             PLLC_BUFFER pFirstBuffer;
  629.             USHORT usReceivedFrameCount;
  630.             PLLC_BUFFER pReceivedFrame;
  631.             USHORT usEventErrorCode;
  632.             USHORT usEventErrorData[3];
  633.         } Event;
  634.  
  635.         struct {
  636.             USHORT usStationId;
  637.             USHORT usDlcStatusCode;
  638.             UCHAR uchFrmrData[5];
  639.             UCHAR uchAccessPritority;
  640.             UCHAR uchRemoteNodeAddress[6];
  641.             UCHAR uchRemoteSap;
  642.             UCHAR uchReserved;
  643.             USHORT usUserStatusValue;
  644.         } Status;
  645.  
  646.     } Type;
  647.  
  648. } LLC_READ_PARMS, *PLLC_READ_PARMS;
  649.  
  650. //
  651. // This data structure gives the best performance in Windows/Nt: The DLC driver
  652. // must copy the CCB and the parameter table. If the driver knows that the
  653. // parameter table is concatenated to the CCB, it can copy both structures at
  654. // once. NOTE: The pointer to the parameter table MUST still be present in the
  655. // CCB
  656. //
  657.  
  658. typedef struct {
  659.     LLC_CCB Ccb;
  660.     LLC_READ_PARMS Parms;
  661. } LLC_READ_COMMAND, *PLLC_READ_COMMAND;
  662.  
  663. //
  664. // New receive types for direct stations, these types are ignored if the direct
  665. // station was opened with a specific ethernet type
  666. //
  667.  
  668. #define LLC_DIR_RCV_ALL_TR_FRAMES       0
  669. #define LLC_DIR_RCV_ALL_MAC_FRAMES      1
  670. #define LLC_DIR_RCV_ALL_8022_FRAMES     2
  671. #define LLC_DIR_RCV_ALL_FRAMES          4
  672. #define LLC_DIR_RCV_ALL_ETHERNET_TYPES  5
  673.  
  674. #define LLC_CONTIGUOUS_MAC      0x80
  675. #define LLC_CONTIGUOUS_DATA     0x40
  676. #define LLC_NOT_CONTIGUOUS_DATA 0x00
  677.  
  678. //
  679. // LLC_BREAK (0x20) is not supported by Windows/Nt
  680. //
  681.  
  682. #define LLC_RCV_READ_INDIVIDUAL_FRAMES  0
  683. #define LLC_RCV_CHAIN_FRAMES_ON_LINK    1
  684. #define LLC_RCV_CHAIN_FRAMES_ON_SAP     2
  685.  
  686. typedef struct {
  687.     USHORT usStationId;             // SAP, link station or direct id
  688.     USHORT usUserLength;            // length of user data in buffer header
  689.     ULONG ulReceiveFlag;            // the received data handler
  690.     PLLC_BUFFER pFirstBuffer;       // first buffer in the pool
  691.     UCHAR uchOptions;               // defines how the frame is received
  692.     UCHAR auchReserved1[3];
  693.     UCHAR uchRcvReadOption;         // defines if rcv frames are chained
  694. } LLC_RECEIVE_PARMS, *PLLC_RECEIVE_PARMS;
  695.  
  696. #define LLC_CHAIN_XMIT_COMMANDS_ON_LINK 0
  697. #define LLC_COMPLETE_SINGLE_XMIT_FRAME  1
  698. #define LLC_CHAIN_XMIT_COMMANDS_ON_SAP  2
  699.  
  700. typedef struct {
  701.     USHORT usStationId;             // SAP, link station or direct id
  702.     UCHAR uchTransmitFs;            // token-ring frame status
  703.     UCHAR uchRemoteSap;             // remote destination SAP
  704.     PLLC_XMIT_BUFFER pXmitQueue1;   // first link list of frame segments
  705.     PLLC_XMIT_BUFFER pXmitQueue2;   // another segment list returuned to pool
  706.     USHORT cbBuffer1;               // length of buffer 1
  707.     USHORT cbBuffer2;               // length of buffer 2
  708.     PVOID pBuffer1;                 // yet another segment
  709.     PVOID pBuffer2;                 // this is the last segment of frame
  710.     UCHAR uchXmitReadOption;        // defines completion event for READ
  711. } LLC_TRANSMIT_PARMS,  *PLLC_TRANSMIT_PARMS;
  712.  
  713. #define LLC_FIRST_DATA_SEGMENT  0x01
  714. #define LLC_NEXT_DATA_SEGMENT   0x02
  715.  
  716. typedef struct {
  717.     UCHAR eSegmentType;             // defines if first or next segment of frame
  718.     UCHAR boolFreeBuffer;           // if set, this buffer is released to pool
  719.     USHORT cbBuffer;                // length of this buffer
  720.     PVOID pBuffer;
  721. } LLC_TRANSMIT_DESCRIPTOR, *PLLC_TRANSMIT_DESCRIPTOR;
  722.  
  723. //
  724. // The frames types returned in the first receive buffer or used with the
  725. // TRANSMIT_FRAMES command.  A direct station may also send only ethernet
  726. // frames. The ethernet types are only for transmit. Types 0x0019 - 0x05DC
  727. // are reserved
  728. //
  729.  
  730. enum _LLC_FRAME_TYPES {                     // Purpose:
  731.     LLC_DIRECT_TRANSMIT         = 0x0000,   // transmit
  732.     LLC_DIRECT_MAC              = 0x0002,   // receive
  733.     LLC_I_FRAME                 = 0x0004,   // receive & transmit
  734.     LLC_UI_FRAME                = 0x0006,   // receive & transmit
  735.     LLC_XID_COMMAND_POLL        = 0x0008,   // receive & transmit
  736.     LLC_XID_COMMAND_NOT_POLL    = 0x000A,   // receive & transmit
  737.     LLC_XID_RESPONSE_FINAL      = 0x000C,   // receive & transmit
  738.     LLC_XID_RESPONSE_NOT_FINAL  = 0x000E,   // receive & transmit
  739.     LLC_TEST_RESPONSE_FINAL     = 0x0010,   // receive & transmit
  740.     LLC_TEST_RESPONSE_NOT_FINAL = 0x0012,   // receive & transmit
  741.     LLC_DIRECT_8022             = 0x0014,   // receive (direct station)
  742.     LLC_TEST_COMMAND_POLL       = 0x0016,   // transmit
  743.     LLC_DIRECT_ETHERNET_TYPE    = 0x0018,   // receive (direct station)
  744.     LLC_LAST_FRAME_TYPE         = 0x001a,   // reserved
  745.     LLC_FIRST_ETHERNET_TYPE     = 0x05DD    // transmit (>)
  746. };
  747.  
  748. typedef struct {
  749.     LLC_CCB Ccb;                    // use this as transmit CCB
  750.     USHORT usStationId;
  751.     USHORT usFrameType;             // DLC frame or ethernet type
  752.     UCHAR uchRemoteSap;             // used with UI, TEST, XID frames
  753.     UCHAR uchXmitReadOption;
  754.     UCHAR Reserved2[2];
  755.     ULONG cXmitBufferCount;
  756.     LLC_TRANSMIT_DESCRIPTOR aXmitBuffer[1];
  757. } LLC_TRANSMIT2_COMMAND, *PLLC_TRANSMIT2_COMMAND;
  758.  
  759. //
  760. // LLC_TRANSMIT2_VAR_PARMS - this macro allocates space for variable length
  761. // descriptor array, eg: LLC_TRANSMIT2_VAR_PARMS(8) TransmitParms;
  762. //
  763.  
  764. #define LLC_TRANSMIT2_VAR_PARMS(a)\
  765. struct {\
  766.     LLC_CCB Ccb;\
  767.     USHORT usStationId;\
  768.     USHORT usFrameType;\
  769.     UCHAR uchRemoteSap;\
  770.     UCHAR uchXmitReadOption;\
  771.     UCHAR uchReserved2[2];\
  772.     ULONG cXmitBufferCount;\
  773.     LLC_TRANSMIT_DESCRIPTOR XmitBuffer[(a)];\
  774. }
  775.  
  776. //
  777. // LLC_PARMS - All CCB parameter tables can be referred to using this union
  778. //
  779.  
  780. union _LLC_PARMS {
  781.     LLC_BUFFER_FREE_PARMS BufferFree;
  782.     LLC_BUFFER_GET_PARMS BufferGet;
  783.     LLC_DLC_CONNECT_PARMS DlcConnectStation;
  784.     LLC_DLC_MODIFY_PARMS DlcModify;
  785.     LLC_DLC_OPEN_SAP_PARMS DlcOpenSap;
  786.     LLC_DLC_OPEN_STATION_PARMS DlcOpenStation;
  787.     LLC_DLC_REALLOCATE_PARMS DlcReallocate;
  788.     LLC_DLC_SET_THRESHOLD_PARMS DlcSetThreshold;
  789.     LLC_DLC_STATISTICS_PARMS DlcStatistics;
  790.     LLC_DIR_INITIALIZE_PARMS DirInitialize;
  791.     LLC_DIR_OPEN_ADAPTER_PARMS DirOpenAdapter;
  792.     LLC_DIR_OPEN_DIRECT_PARMS DirOpenDirect;
  793.     LLC_DIR_READ_LOG_PARMS DirReadLog;
  794.     LLC_DIR_SET_EFLAG_PARMS DirSetEventFlag;
  795.     LLC_DIR_STATUS_PARMS DirStatus;
  796.     LLC_READ_PARMS Read;
  797.     LLC_RECEIVE_PARMS Receive;
  798.     LLC_TRANSMIT_PARMS Transmit;
  799.     LLC_TRANSMIT2_COMMAND Transmit2;
  800.     LLC_TRACE_INITIALIZE_PARMS TraceInitialize;
  801. };
  802.  
  803. //
  804. // LLC_STATUS - enumerates the return codes which appear in the CCB uchDlcStatus
  805. // field
  806. //
  807.  
  808. typedef enum _LLC_STATUS {
  809.     LLC_STATUS_SUCCESS                      = 0x00,
  810.     LLC_STATUS_INVALID_COMMAND              = 0x01,
  811.     LLC_STATUS_DUPLICATE_COMMAND            = 0x02,
  812.     LLC_STATUS_ADAPTER_OPEN                 = 0x03,
  813.     LLC_STATUS_ADAPTER_CLOSED               = 0x04,
  814.     LLC_STATUS_PARAMETER_MISSING            = 0x05,
  815.     LLC_STATUS_INVALID_OPTION               = 0x06,
  816.     LLC_STATUS_COMMAND_CANCELLED_FAILURE    = 0x07,
  817.     LLC_STATUS_ACCESS_DENIED                = 0x08,   // not used in Windows/Nt
  818.     LLC_STATUS_ADAPTER_NOT_INITIALIZED      = 0x09,   // not used in Windows/Nt
  819.     LLC_STATUS_CANCELLED_BY_USER            = 0x0A,
  820.     LLC_STATUS_COMMAND_CANCELLED_CLOSED     = 0x0B,   // not used in Windows/Nt
  821.     LLC_STATUS_SUCCESS_NOT_OPEN             = 0x0C,
  822.     LLC_STATUS_TIMER_ERROR                  = 0x11,
  823.     LLC_STATUS_NO_MEMORY                    = 0x12,
  824.     LLC_STATUS_INVALID_LOG_ID               = 0x13,   // not used in Windows/Nt
  825.     LLC_STATUS_LOST_LOG_DATA                = 0x15,
  826.     LLC_STATUS_BUFFER_SIZE_EXCEEDED         = 0x16,
  827.     LLC_STATUS_INVALID_BUFFER_LENGTH        = 0x18,
  828.     LLC_STATUS_INADEQUATE_BUFFERS           = 0x19,
  829.     LLC_STATUS_USER_LENGTH_TOO_LARGE        = 0x1A,
  830.     LLC_STATUS_INVALID_PARAMETER_TABLE      = 0x1B,
  831.     LLC_STATUS_INVALID_POINTER_IN_CCB       = 0x1C,
  832.     LLC_STATUS_INVALID_ADAPTER              = 0x1D,
  833.     LLC_STATUS_LOST_DATA_NO_BUFFERS         = 0x20,
  834.     LLC_STATUS_LOST_DATA_INADEQUATE_SPACE   = 0x21,
  835.     LLC_STATUS_TRANSMIT_ERROR_FS            = 0x22,
  836.     LLC_STATUS_TRANSMIT_ERROR               = 0x23,
  837.     LLC_STATUS_UNAUTHORIZED_MAC             = 0x24,   // not used in Windows/Nt
  838.     LLC_STATUS_MAX_COMMANDS_EXCEEDED        = 0x25,   // not used in Windows/Nt
  839.     LLC_STATUS_LINK_NOT_TRANSMITTING        = 0x27,
  840.     LLC_STATUS_INVALID_FRAME_LENGTH         = 0x28,
  841.     LLC_STATUS_INADEQUATE_RECEIVE           = 0x30,   // not used in Windows/Nt
  842.     LLC_STATUS_INVALID_NODE_ADDRESS         = 0x32,
  843.     LLC_STATUS_INVALID_RCV_BUFFER_LENGTH    = 0x33,
  844.     LLC_STATUS_INVALID_XMIT_BUFFER_LENGTH   = 0x34,
  845.     LLC_STATUS_INVALID_STATION_ID           = 0x40,
  846.     LLC_STATUS_LINK_PROTOCOL_ERROR          = 0x41,
  847.     LLC_STATUS_PARMETERS_EXCEEDED_MAX       = 0x42,
  848.     LLC_STATUS_INVALID_SAP_VALUE            = 0x43,
  849.     LLC_STATUS_INVALID_ROUTING_INFO         = 0x44,
  850.     LLC_STATUS_RESOURCES_NOT_AVAILABLE      = 0x46,   // not used in Windows/Nt
  851.     LLC_STATUS_LINK_STATIONS_OPEN           = 0x47,
  852.     LLC_STATUS_INCOMPATIBLE_COMMANDS        = 0x4A,
  853.     LLC_STATUS_OUTSTANDING_COMMANDS         = 0x4C,   // not used in Windows/Nt
  854.     LLC_STATUS_CONNECT_FAILED               = 0x4D,
  855.     LLC_STATUS_INVALID_REMOTE_ADDRESS       = 0x4F,
  856.     LLC_STATUS_CCB_POINTER_FIELD            = 0x50,
  857.     LLC_STATUS_INVALID_APPLICATION_ID       = 0x52,   // not used in Windows/Nt
  858.     LLC_STATUS_NO_SYSTEM_PROCESS            = 0x56,   // not used in Windows/Nt
  859.     LLC_STATUS_INADEQUATE_LINKS             = 0x57,
  860.     LLC_STATUS_INVALID_PARAMETER_1          = 0x58,
  861.     LLC_STATUS_DIRECT_STATIONS_NOT_ASSIGNED = 0x5C,
  862.     LLC_STATUS_DEVICE_DRIVER_NOT_INSTALLED  = 0x5d,
  863.     LLC_STATUS_ADAPTER_NOT_INSTALLED        = 0x5e,
  864.     LLC_STATUS_CHAINED_DIFFERENT_ADAPTERS   = 0x5f,
  865.     LLC_STATUS_INIT_COMMAND_STARTED         = 0x60,
  866.     LLC_STATUS_TOO_MANY_USERS               = 0x61,   // not used in Windows/Nt
  867.     LLC_STATUS_CANCELLED_BY_SYSTEM_ACTION   = 0x62,
  868.     LLC_STATUS_DIR_STATIONS_NOT_AVAILABLE   = 0x63,   // not used in Windows/Nt
  869.     LLC_STATUS_NO_GDT_SELECTORS             = 0x65,
  870.     LLC_STATUS_MEMORY_LOCK_FAILED           = 0x69,
  871.  
  872.     //
  873.     // New NT DLC specific error codes begin from 0x80
  874.     // These error codes are for new Windows/Nt DLC apps.
  875.     //
  876.  
  877.     LLC_STATUS_INVALID_BUFFER_ADDRESS       = 0x80,
  878.     LLC_STATUS_BUFFER_ALREADY_RELEASED      = 0x81,
  879.     LLC_STATUS_BIND_ERROR                   = 0xA0,   // not used in Windows/Nt
  880.     LLC_STATUS_INVALID_VERSION              = 0xA1,
  881.     LLC_STATUS_NT_ERROR_STATUS              = 0xA2,
  882.     LLC_STATUS_PENDING                      = 0xFF
  883. } LLC_STATUS;
  884.  
  885. #define LLC_STATUS_MAX_ERROR 0xFF
  886.  
  887. //
  888. // ACSLAN_STATUS - status codes which are returned from AcsLan
  889. //
  890.  
  891. typedef enum {
  892.     ACSLAN_STATUS_COMMAND_ACCEPTED = 0,
  893.     ACSLAN_STATUS_INVALID_CCB_POINTER = 1,
  894.     ACSLAN_STATUS_CCB_IN_ERROR = 2,
  895.     ACSLAN_STATUS_CHAINED_CCB_IN_ERROR = 3,
  896.     ACSLAN_STATUS_SYSTEM_ERROR = 4,
  897.     ACSLAN_STATUS_SYSTEM_STATUS = 5,
  898.     ACSLAN_STATUS_INVALID_COMMAND = 6
  899. } ACSLAN_STATUS;
  900.  
  901. //
  902. // prototypes
  903. //
  904.  
  905. ACSLAN_STATUS
  906. APIENTRY
  907. AcsLan(
  908.     IN OUT PLLC_CCB pCcb,
  909.     OUT PLLC_CCB* ppBadCcb
  910.     );
  911.  
  912. #ifdef __cplusplus
  913. }
  914. #endif
  915.  
  916. #pragma option pop
  917. #endif // _DLCAPI_
  918.